import { BaseEntity } from '@cool-midway/core';
import { Column, Entity, Index } from 'typeorm';

/**
 * 任务话题
 */
@Entity('task_topic')
export class TaskTopicEntity extends BaseEntity {
  @Index()
  @Column({ comment: '应用ID' })
  appId: number;

  @Column({ comment: '名称' })
  name: string;

  @Column({ comment: '状态 0-禁用 1-启用', default: 1 })
  status: number;

  @Column({ comment: '是否初始化 0-否 1-是', default: 0 })
  isInit: number;

  @Column({ comment: '类型 0-HTTP 1-MQTT', default: 0 })
  type: number;

  @Column({ comment: 'HTTP请求地址', nullable: true })
  HTTPUrl: string;

  @Column({ comment: 'MQTT请求地址', nullable: true })
  MQTTUrl: string;

  @Column({ comment: '连接参数', type: 'json', nullable: true })
  connectOptions: string;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
